﻿<UserControl x:Class="AtletIS.UI.Views.PressView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:vm="clr-namespace:AtletIS.UI.ViewModels"
             xmlns:views="clr-namespace:AtletIS.UI.Views"
             xmlns:controls="clr-namespace:AtletIS.UI.Controls"
             xmlns:conv="clr-namespace:AtletIS.UI.Converters"
             mc:Ignorable="d" 
             d:DesignHeight="800" d:DesignWidth="1200">
    
    <UserControl.DataContext>
        <vm:PressViewModel/>
    </UserControl.DataContext>
    
    <UserControl.Background>
        <ImageBrush ImageSource="../Resources/Images/background.png"  Stretch="UniformToFill"/>
    </UserControl.Background>
    
    <UserControl.Resources>
        <DataTemplate DataType="{x:Type vm:DisciplineListViewModel}">
            <views:DisciplineListTreeView />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:StartListViewModel}">
            <views:StartListView />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:ResultsViewModel}">
            <views:ResultsView />
        </DataTemplate>
    </UserControl.Resources>
    
    <Grid>
        <Grid.Resources>
            <conv:BoolInverterConverter x:Key="MyBoolInverterConverter" />
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="400"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="100"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- ActiveCompetition -->
        <Border DataContext="{Binding ActiveCompetition}" Margin="10,5" Padding="20,0">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="6*"/>
                    <RowDefinition Height="4*"/>
                </Grid.RowDefinitions>
                <Image Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Source="../Resources/Images/logo100.png" />
                <TextBlock Grid.Row="0" Grid.Column="2" VerticalAlignment="Bottom" FontSize="32" Foreground="SteelBlue" Text="{Binding Name}" />
                <TextBlock Grid.Row="1" Grid.Column="2" VerticalAlignment="Top" FontSize="16" Foreground="SteelBlue" Text="{Binding CompetitionInfo}" />
            </Grid>
        </Border>

        <!-- Functions -->
        <Border Grid.Row="1" Margin="10,5" Background="{StaticResource ToolbarBG}" BorderThickness="2" BorderBrush="#FFFFFFFF" CornerRadius="12">
            <Grid>
                <StackPanel  Orientation="Horizontal" HorizontalAlignment="Left"  >
                    <RadioButton Template="{StaticResource ToolbarButton}" Content="START LIST" Command="{Binding Path=StartListCommand}" IsChecked="True" />
                    <RadioButton Template="{StaticResource ToolbarButton}" Content="RESULTS" Command="{Binding Path=ResultsCommand}" />
                    <RadioButton Template="{StaticResource ToolbarButton}" Content="CHIP RESULTS" Command="{Binding Path=StartListCommand}" />
                    <RadioButton Template="{StaticResource ToolbarButton}" Content="CHIP VIEWER" Command="{Binding Path=ResultsCommand}" />
                </StackPanel>
                <StackPanel  Orientation="Horizontal" HorizontalAlignment="Right"  >
                    <RadioButton Template="{StaticResource SmallToolbarButton}" Content="Pages" IsChecked="{Binding HasPages}" />
                    <RadioButton Template="{StaticResource SmallToolbarButton}" Content="All" IsChecked="{Binding HasPages, Converter={StaticResource MyBoolInverterConverter}}" />
                </StackPanel>
            </Grid>
        </Border>

        <!-- Content -->
        <Grid Grid.Row="2" Margin="10,5">
            <controls:FlipPanel SpinAxis="Vertical" SpinTime="1" FrontVisible="{Binding Path=FacingFront}">
                <controls:FlipPanel.Front>
                    <ContentControl Content="{Binding Path=FrontOutputViewModel}" />
                </controls:FlipPanel.Front>
                <controls:FlipPanel.Back>
                    <ContentControl Content="{Binding Path=BackOutputViewModel}" />
                </controls:FlipPanel.Back>
            </controls:FlipPanel>
        </Grid>

        <!-- DisciplineList -->
        <Grid Grid.Column="1" Grid.Row="0" Grid.RowSpan="3">
            <controls:RoundedBox Margin="10" />
            <ContentControl Content="{Binding Path=DisciplineListViewModel}" Margin="15"/>
        </Grid>
        
    </Grid>
</UserControl>
